<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('risks', function (Blueprint $table) {
            $table->id();
            $table->string('title');
            $table->unsignedBigInteger('project_id')->index()->comment('所属项目ID');
            $table->tinyInteger('user_id')->default(0);
            $table->unsignedBigInteger('person_id')->default(0)->index()->comment('责任人');
            $table->string('measure')->default('/')->comment('措施');
            $table->string('type')->default('')->comment('类型');
            $table->string('effectiveness')->default('/')->comment('反馈');
            $table->date('start_date')->nullable()->comment('项目开始时间');
            $table->date('end_date')->nullable()->comment('项目结束时间');
            $table->tinyInteger('status')->index()->default(1)->comment('0未开始、2进行中、1已完成');
            $table->timestamps();
        });

    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('risks');
    }
};
